package com.springbootee.uitl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 * @name:BasePageResult
 * @author:dell
 * @time:2021/10/20 9:59
 */
@Data
@ToString
@ApiIgnore
public class BasePageResult<T> {
    private List<T> data;//分页响应的
    @ApiModelProperty(value ="总条数")
    private Long  totalum;//总条数
    public  BasePageResult(List<T> data,Long totalum){
            this.data=data;
            this.totalum=totalum;
    }
    public static <E> BasePageResult<E>  newInstance(IPage<E> page){
        return new BasePageResult<E>(page.getRecords(),page.getTotal());
    }
}
